import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cook_dinner/config/include.dart';

List<String> list = ['干锅香辣土豆片，香辣过瘾又下饭', '蒜蓉粉丝金针菇~超简单快手菜', '玉米胡萝卜山药炖排骨~周末炖个汤'];

class SearchList extends StatelessWidget {
  const SearchList({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SliverList(
      delegate: SliverChildBuilderDelegate(
        childCount: 3,
        (BuildContext context, int index) {
          return Container(
            width: double.infinity,
            padding: EdgeInsets.only(left: 13.rpx, right: 13.rpx),
            margin: EdgeInsets.only(bottom: 16.rpx),
            child: Stack(
              children: [
                Container(
                  width: double.infinity,
                  height: 117.rpx,
                  margin: EdgeInsets.only(top: 13.7.rpx),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(20.rpx),
                    color: Colors.white,
                  ),
                  child: Row(
                    children: [
                      ClipRRect(
                        borderRadius: BorderRadius.circular(12.rpx),
                        child: Image.asset(
                          'assets/images/prot0${index + 1}.png',
                          width: 156.rpx,
                          height: 117.rpx,
                          fit: BoxFit.cover,
                        ),
                      ),
                      SizedBox(width: 13.7.rpx),
                      Expanded(
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            SizedBox(height: 7.rpx),
                            SizedBox(
                              width: double.infinity,
                              height: 45.rpx,
                              child: Text(
                                list[index],
                                style: TextStyle(
                                  fontSize: 14.rpx,
                                  color: const Color(0xff333333),
                                ),
                              ),
                            ),
                            SizedBox(height: 7.rpx),
                            Text(
                              '122.0万浏览    5.0万收藏',
                              style: TextStyle(
                                fontSize: 14.rpx,
                                color: const Color(0xff808080),
                              ),
                            ),
                            SizedBox(height: 15.rpx),
                            Row(
                              crossAxisAlignment: CrossAxisAlignment.center,
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Text(
                                  '15min',
                                  style: TextStyle(
                                    fontSize: 14.rpx,
                                    color: const Color(0xffFA8303),
                                  ),
                                ),
                                Image.asset(
                                  'assets/images/group_star.png',
                                  height: 12.rpx,
                                ),
                              ],
                            ),
                          ],
                        ),
                      ),
                      SizedBox(width: 24.rpx),
                    ],
                  ),
                ),
                Container(
                  width: 32.32.rpx,
                  height: 50.7.rpx,
                  padding: EdgeInsets.only(top: 5.rpx),
                  decoration: const BoxDecoration(
                    image: DecorationImage(
                      image: AssetImage('assets/images/tag.png'),
                      fit: BoxFit.cover,
                    ),
                  ),
                  child: Column(
                    children: [
                      Text(
                        'TOP',
                        style: TextStyle(color: Colors.white, fontSize: 14.rpx),
                      ),
                      SizedBox(height: 4.rpx),
                      Text(
                        index + 1 < 10 ? '0${index + 1}' : '${index + 1}',
                        style: TextStyle(color: Colors.white, fontSize: 13.rpx),
                      )
                    ],
                  ),
                ),
              ],
            ),
          );
        },
      ),
    );
  }
}
